-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improvements in the reader from openPMD file #158
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Tests pass, this is ready for review :) |
Thanks @AngelFP. The laser propagation is quite well-captured. Final iteration below. Unfortunately, the agreement still isn't great, but nothing that can obviously be attributed to LASY, probably some convergence question. |
ts = OpenPMDTimeSeries(path) | ||
F, m = ts.get_field(iteration=iteration, field=field, coord=coord, theta=None) | ||
assert m.axes in [ | ||
{0: "x", 1: "y", 2: "z"}, | ||
{0: "z", 1: "y", 2: "x"}, | ||
{0: "x", 1: "y", 2: "t"}, | ||
{0: "t", 1: "y", 2: "x"}, | ||
] | ||
|
||
if m.axes in [{0: "z", 1: "y", 2: "x"}, {0: "t", 1: "y", 2: "x"}]: | ||
F = F.swapaxes(0, 2) | ||
|
||
if "z" in m.axes.values(): | ||
t = (m.z - m.z[0]) / c | ||
else: | ||
t = m.t | ||
axes = {"x": m.x, "y": m.y, "t": t} | ||
|
||
# If array does not contain the envelope but the electric field, | ||
# extract the envelope with a Hilbert transform | ||
if envelope == False: | ||
# Assumes z is last dimension! | ||
h = hilbert(F) | ||
F, m = ts.get_field(iteration=iteration, field=field, coord=coord, theta=theta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle, we could avoid depending on the viewer here, but that would take a bit more work (in particular to properly convert from RZ decomposition of fields to RZ decomposition of envelope). I would be happy to discuss this.
Thanks @AngelFP for your review, I addressed your comments in the last commits. |
Great, thanks! |
This PR proposes the following improvements, all meant to achieve #127:
With these changes, the output of an FBPIC simulation can be sent as the input of a HiPACE++ simulation. The figure below shows, for a laser pulse in a parabolic channel, the pulse width during propagation, when starting the HiPACE++ simulation from the output of the FBPIC simulation at different times. Significant differences can be observed, which could very much come from differences between the two codes: even without using LASY the two codes give slightly different results for this case. This is probably a matter of tuning the resolution, box size, time step etc., so I do not think it is necessarily a problem.

laser_width_hipace_fbpic.pdf
The scripts I used are posted below, so we can later work on the agreement. I had to add some .txt to upload the files.
inputs_fbpic.py.txt
inputs_hipace.txt
script_fbpic.sh.txt
script_hipace.sh.txt
The lasy handling was done using: